import { createRouter, createWebHashHistory } from 'vue-router'

const router = createRouter({
  history: createWebHashHistory(),
  routes: [
    { path: '/', redirect: '/home' },
    // {
    //   path: '/home',
    //   name: 'home',
    //   meta: { title: '首页' },
    //   component: () => import('@/views/Home.vue')
    // },
    {
      path: '/',
      component: () => import('@/layout/DefaultLayout.vue'),
      children: [
        {
          path: '/home',
          name: 'home',
          meta: { title: '首页' },
          component: () => import('@/views/Home.vue')
        },
        {
          path: 'diy',
          name: 'diy',
          meta: { title: 'DIY页面' },
          component: () => import('@/views/diy/index.vue')
        },
        {
          path: 'diy/demo',
          name: 'diy-demo',
          meta: { title: '动态组件渲染演示' },
          component: () => import('@/views/diy/dynamic-component-demo.vue')
        },
        {
          path: 'debug',
          name: 'debug',
          meta: { title: '调试记录' },
          component: () => import('@/views/debug/List.vue')
        },
        {
          path: 'event',
          name: 'event',
          meta: { title: '事件列表' },
          component: () => import('@/views/event/List.vue')
        },
        {
          path: 'exception',
          name: 'exception',
          meta: { title: '错误日志' },
          component: () => import('@/views/exception/List.vue')
        },
        {
          path: 'addons',
          name: 'addon-list',
          meta: { title: '应用管理' },
          component: () => import('@/views/addons/addon/List.vue')
        },
        {
          path: 'addons/version/:aid',
          name: 'addon-version',
          meta: { title: '应用管理-版本管理' },
          component: () => import('@/views/addons/version/List.vue')
        },
        {
          path: 'crud/:aid',
          name: 'crud-addon',
          meta: { title: '代码生成-数据库管理' },
          component: () => import('@/views/crud/mysql.vue')
        }
      ]
    }
  ]
})

export default router
